﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <link href="../Plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <link href="../zui/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Plugins/keyboard/css/keyboard.min.css" rel="stylesheet" />
    <link href="../zui/css/font-awesome.min.css" rel="stylesheet" />
    <link href="../zui/css/zui.min.css" rel="stylesheet" />
    <link href="../Plugins/jquery-step/jquery.steps.css" rel="stylesheet" />
    <link href="../Plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <link href="../zui/css/app.css" rel="stylesheet" />
    <style type="text/css">
        body {
            font-size: 16px !important;
        }

        .panel-primary > .panel-heading {
            border-radius: 0px;
        }

        .panel {
            margin-bottom: 2px;
        }

        .syxx {
            width: 200px;
            margin-top: 15px;
        }

            .syxx button {
                height: 35px;
            }

        .syxx1 {
            margin-top: 12px;
            margin-left: 35px;
        }

            .syxx1 button {
                width: 120px;
                height: 55px;
            }

        .highcharts-credits {
            display: none !important;
        }

        .chart-content {
            margin-bottom: 5px;
            box-shadow: 0 3px 4px #ddd;
        }

        .recordMark {
            color: green
        }
        #webcam img {
            width: 640px !important;
            height: 330px !important;
        }
    </style>
</head>
<body onload="createImageLayer();">
    <!--<div id="videoControl" style="width:870px;height:330px;background-color:#FFF;border:2px solid double;z-index:9999999!important;position:absolute;display:none">
        <div id="webcam" style="width:640px;left:0px;height:330px;position:absolute;z-index:999999999;background-color:#808080"><noscript><img src="http://127.0.0.1/?action=snapshot" /></noscript></div>

        <div style="width:230px;right:0px;height:330px; overflow:hidden; position:absolute">
            <div class="ControlMask" style="width:230px;right:0px;height:330px;position:absolute;z-index:999999999;opacity:0.5;background-color:#808080"></div>
            <div class="panel panel-primary" style="border-radius:0px !important" disabled="disabled">
                <div class="panel-heading">视频录制控制</div>
                <div class="panel-body" style="height:83px;text-align:center;line-height:35px;padding:0px">
                    <input type="hidden" id="VideoRecordStatus" value="0" />
                    <span class="VideoRecordStatusTxt">未在录制</span><br />
                    <button class="btn btn-success RecordVideo" type="button">开始录制</button> <button class="btn OpenVideoPath" type="button">打开目录</button> <button class="btn OpenLight" val="0" type="button">开灯</button>
                </div>
            </div>
            <div class="panel panel-primary" style="border-radius:0px !important">
                <div class="panel-heading">试验现象确认</div>
                <div class="panel-body" style="height:160px;padding-top:0px !important;padding-bottom:0px !important">
                    <div class="btn-group btn-group-vertical syxx">
                        <button type="button" class="btn stopExperiment" value="1">试样爆炸</button>
                        <button type="button" class="btn stopExperiment" value="2">试样燃烧</button>
                        <button type="button" class="btn stopExperiment" value="3">试样变色</button>
                        <button type="button" class="btn stopExperiment" value="0">无变化</button>
                    </div>
                </div>
            </div>
        </div>

    </div>-->
    <div id="sycontent" style="height:800px; overflow-y:scroll; overflow-x:hidden !important">
        <div class="row" style="color:#f1a325; font-size:18px">
            <div class="col-xs-2">
                试验材料：<span id="Sycl"></span>
            </div>
            <div class="col-xs-2">
                模具类型：<span id="Symj">75</span>cm 模具
            </div>
            <div class="col-xs-2">
                试验距离：<span id="Syjl">48</span>cm
            </div>
            <div class="col-xs-3">
                点火方式：<span id="Dhfs">48</span>
            </div>
        </div>
        <hr style="border-color:#d0c8c8" />
        <!--<div class="row shiyan-status" style="color:#f1a325;margin-top:15px;height:120px;overflow-y:hidden">
            <div class="col-xs-4">
                <div style="margin-left:68px"><img src="../static/images/shiyan1.png" /></div>
            </div>
            <div class="col-xs-8">
                <div style="font-size:20px;margin-top:10px">请将试样放入烘箱中，并关闭烘箱门，准备就绪后开始试验！</div>
            </div>
        </div>
        <div class="row shiyan-status" style="color:#f1a325;margin-top:15px;height:120px;display:none;overflow-y:hidden">
            <div class="col-xs-4" style="margin-top:10px;">
                <div style="width:90px;height:90px;" class="sk-spinner sk-spinner-rotating-plane"></div>
            </div>
            <div class="col-xs-8">
                <div style="font-size:20px;margin-top:18px">正在整定温度...</div>
                <div><span class="shiyan-hxwd" style="font-size:20px">获取温度中...</span><span style="font-size:20px;display:none">   </span></div>
            </div>
        </div>
        <div class="row shiyan-status" style="color:#f1a325;margin-top:15px;height:120px;display:none;overflow-y:hidden">
            <div class="col-xs-4" style="margin-top:10px;">
                <div style="width:90px;height:90px;" class="sk-spinner sk-spinner-rotating-plane"></div>
            </div>
            <div class="col-xs-8">
                <div style="font-size:20px;margin-top:18px;display:none">正在试验中...</div>
                <div><span id="shiyan-time" style="font-size:20px">试验已用时：0分0秒</span><span style="font-size:20px;display:none">  正在试验中... </span></div>
                <div><span class="shiyan-hxwd" style="font-size:20px">获取温度中...</span><span style="font-size:20px;display:none">   </span></div>
            </div>
        </div>
        <hr />
        <div class="ibox float-e-margins" style="width:870px;">
            <div class="ibox-content">
                <div style="background-color:#FFF;border:2px solid double;position:relative; box-shadow: 0 3px 4px #ddd;">
                    <div class="ControlMask" style="top:0px;width:870px; height:191px;position:absolute;z-index:99!important;opacity:0.5;background-color:#808080"></div>
                    <div class="row">
                        <div class="col-xs-4" style="margin-bottom:15px">
                            <div class="panel panel-primary" style="border-radius:0px !important" disabled="disabled">
                                <div class="panel-heading">视频录制控制</div>
                                <div class="panel-body" style="height:120px;text-align:center;line-height:35px;padding:0px">
                                    <input type="hidden" id="VideoRecordStatus" value="0" />
                                    <div style="height:20px"></div>
                                    <span class="VideoRecordStatusTxt">未在录制</span><br />
                                    <button class="btn btn-success RecordVideo" type="button">开始录制</button> <button class="btn OpenVideoPath" type="button">打开视频目录</button>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-8" style="margin-bottom:15px">
                            <div class="panel panel-primary" style="border-radius:0px !important">
                                <div class="panel-heading">试验现象确认</div>
                                <div class="panel-body" style="height:120px">
                                    <div class="btn-group syxx1">
                                        <button type="button" class="btn stopExperiment" value="1">试样爆炸</button>
                                        <button type="button" class="btn stopExperiment" value="2">试样燃烧</button>
                                        <button type="button" class="btn stopExperiment" value="3">试样变色</button>
                                        <button type="button" class="btn stopExperiment" value="0">无变化</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <hr />
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h3 id="bh">温度监测</h3>
                <div class="ibox-tools">
                </div>
            </div>
            <div class="ibox-content">
                <div class="flot-chart">
                    <div class="chart-content" id="flot-line-chart-moving1" style="width:870px;height:200px"></div>
                </div>
                <div class="flot-chart" style="display:none">
                    <div class="chart-content" id="flot-line-chart-moving2" style="width:870px;height:200px"></div>
                </div>
            </div>
        </div>-->



    </div>
    <div class="shiyan-footer" style="padding-bottom:-10px !important;margin-bottom: 8px;">
        <button style="height:50px;float:left;margin-right:5px" class="btn btn-danger home-btn" type="button">退出试验</button>
        <!--<button style="float:left;margin-right:5px" class="btn btn-default fm-btn" type="button">开启阀门</button>-->
        <!--<button style="height:50px;float:left;margin-right:5px" class="btn btn-default sxt-btn" type="button">查看实时图像</button>-->
        <!--<button style="float:left" class="btn btn-default splj-btn" type="button">视频目录配置</button>-->
        <button style="height:50px;float:right" class="btn btn-primary complet-shiyan" type="button">完成试验</button>
    </div>
    <script src="../zui/lib/jquery/jquery.js"></script>
    <script src="../zui/js/socket.io.min.js"></script>
    <script src="../Plugins/jquery-ui/jquery-ui.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.mousewheel.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.extension-mobile.min.js"></script>
    <script src="../Plugins/sweetalert/sweetalert.min.js"></script>
    <script src="../Plugins/Highcharts-6.1.0/code/highcharts.js"></script>
    <script src="../Plugins/Highcharts-6.1.0/code/modules/exporting.js"></script>
    <script src="../Plugins/Highcharts-6.1.0/code/modules/export-data.js"></script>
    <script src="../Plugins/jquery-step/jquery.steps.min.js"></script>
    <script src="../zui/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="../zui/lib/swiper/js/swiper.min.js"></script>
    <script src="../zui/lib/layer/layer.js"></script>
    <script src="../zui/js/utils.js"></script>
    <script src="../zui/js/app.js"></script>
    <script src="../zui/js/socket.io.min.js"></script>
    <script type="text/javascript">
        var shiyan = true;
        var t = 0;
        var index = getQueryString("index");
        //实验ID
        var experimentStepId = "";
        var socket;
        //试样温度
        var temp1 = 0;
        //腔体温度（主）
        var temp2 = 0;
        //腔体温度（辅 PID）
        var temp3 = 0;
        //稳定温度
        var temp4 = 0;
        var kg = 0;
        var fq = 0;
        var kgMark = 0;
        var fqMark = 0;
        var kgStartTime = 0;
        var fqStartTime = 0;
        var tempStatus = 0;
        var startTime = 0;
        var currentShiYanTime = 0;
        var startExperimentMark = false;
        $(function () {
            Highcharts.setOptions({
                global: {
                    timezoneOffset: -8 * 60
                }
            });
            $(".syIndex").text(index);
            $("#Sycl").text(sessionStorage.Sycl);
            $("#Sywd").text(sessionStorage.Sywd);
            $("#Sysc").text(sessionStorage.Sysc);
            $(".splj-btn").click(function () {
                top.layer.open({
                    title: "视频目录配置",
                    type: 2,
                    shadeClose: false, //必须点弹窗关闭按钮关闭
                    shade: 0.1,
                    closeBtn: 1,
                    move: false,
                    area: ['500px', '260px'], //宽高
                    btn: ['保存', '取消'],
                    content: ['VideoSetting.html', 'no'],
                    yes: function (index, layero) {

                        if (top.sysControl.SaveVideoPath(top.frames[$(layero).find("iframe").prop("name")].getVal()) == "ok") {
                            top.layer.close(index);
                            top.layer.msg("保存成功")
                        }
                    }
                });

            });
            $(".OpenVideoPath").click(function () {
                top.myService.OpenExplore(sessionStorage.CurrentExperimentId, parseInt(sessionStorage.syIndex));
            });
            $(".complet-shiyan").click(function () {
                if (sysControl.CompletTest() == "1") {
                    sysControl.HidePanel();
                    completion(2);
                };
            });
            $(".sxt-btn").click(function () {

                if ($(this).text() == "查看实时图像") {
                    $(this).text("查看试验详情")
                    $("#videoControl").show();
                    $("#sycontent").css("overflow-y", "hidden");
                }
                else {
                    $(this).text("查看实时图像")
                    $("#sycontent").css("overflow-y", "scroll");
                    $("#videoControl").hide();
                }
            });

            $(".home-btn").click(function () {

                //if ($(".sxt-btn").text() != "查看摄像头") {
                //    $("#bh").text("实验温度")
                //    $(".sxt-btn").text("查看摄像头")
                //    top.sys.hideCamera();
                //}
                top.layer.confirm(
                    "您确定要退出本次试验么？",
                    {
                        btn: ['是的，我确定结束！', '不小心点错了'],
                        icon: 0,
                        title: '操作确认',
                        offset: '3px',
                        closeBtn: 0,
                        shade: 0.01,
                        move: false
                    },
                    function (index) {
                        top.layer.close(index);
                        sysControl.HidePanel();
                        completion(0);
                    },
                    function () {

                    }
                );
                //swal({
                //    title: "您确定要结束本次“标准试验”流程么？",
                //    text: "结束后系统将跳转至主界面，且本次试验数据不再保持！",
                //    type: "warning",
                //    animation: false,
                //    showCancelButton: true,
                //    cancelButtonText: "不小心点错了",
                //    confirmButtonColor: "#DD6B55",
                //    confirmButtonText: "是的，我确定结束！",
                //    closeOnConfirm: false
                //}, function () {
                //    $("#userinfo-btn", top.document).removeClass("disabled");
                //    top.dataOpera.stopDisplayTemp();
                //    $("#content-frame", top.document).attr("src", "Menu.html");
                //    $("#menu-title", top.document).removeClass().addClass("fa fa-home").text(" 功能菜单");

                //});

            });


        });
        function completion(type, fun) {

            shiyan = false
            /* top.myService.HideCamera();
              top.myService.StopRecordVideo(); */
            $("#videoControl").hide();
            var ltxt = type == 0 ? "正在结束试验..." : '正在保存试验数据...';
            var loadingIndex = top.layer.msg(ltxt, {
                time: 0, icon: 16, shade: 0.01
            });

            switch (type) {
                case 0:
                    sysControl.ClearTestData();
                    $("#userinfo-btn", top.document).removeClass("disabled");
                    $("#content-frame", top.document).attr("src", "Menu.html");
                    $("#menu-title", top.document).removeClass().addClass("fa fa-home").text(" 功能菜单");
                    top.layer.close(loadingIndex);
                    break;
                case 1:
                    if (fun != null) {
                        fun();
                    }
                    break;
                case 2:
                    var result = '';
                    var frameData = (sysControl.GetTestData()).split(',');
                    var shijian = (parseFloat(frameData[1]) - parseFloat(frameData[0])) / 1000.0
                    var juli = parseInt(sessionStorage.Syjl) / 100.0;
                    var sulv = (juli / shijian).toFixed(3);
                    $.ajax({
                        url: sessionStorage.CurrentHttpAddress + "/updateExperiment",
                        type: "get",
                        data: {
                            experiment_id: sessionStorage.CurrentExperimentId,
                            start_frame: frameData[0], end_frame: frameData[1],
                            total_count: parseInt(sessionStorage.syIndex),
                            result: '距离' + juli + 'm，燃烧时间' + shijian + 's,此样品燃烧速率为' + sulv + 'm/s'
                        },
                        success: function (res) {
                            top.layer.close(loadingIndex);
                            parent.stepNext();
                            if (fun != null) {
                                fun();
                            }
                            $('#content-frame3', window.parent.document).attr("src", "Result.html?experimentId=" + sessionStorage.CurrentExperimentId);

                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            top.layer.close(loadingIndex);
                            if (error == null) {
                                alert(errorThrown);
                            }
                            else {
                                error(errorThrown);
                            }
                        }
                    });


                default:
            }

        }
        function pjz(time1, time2) {

            var cha = Math.abs(Number(time2) - Number(time1)) / 10;
            var pj = ((Number(time2) + Number(time1)) / 20);

            return pj;
        }
        function xs(time1, time2) {

            var cha = Math.abs(Number(time2) - Number(time1)) / 10;
            var pj = ((Number(time2) + Number(time1)) / 20);

            return cha / pj;
        }

        Highcharts.setOptions({
            global: {
                useUTC: false
            }
        });

    </script>
</body>
</html>
